<?php
/************************FoxPHP威客系统************************/
/*                                                            */
/*  FoxPHP.Com (C)2006-2016 FoxPHP Inc.                       */
/*  This is NOT a freeware, use is subject to license terms   */
/*  FoxPHP威客系统是商业软件,使用于商业用途请购买授权         */
/*  V3.0 2016.3                                               */
/*  foxphp@aliyun.com                                         */
/*  http://www.foxphp.com                                     */
/*                                                            */
/**************************************************************/

namespace Get\Controller;
use Think\Controller;
class ForgotpasswordController extends Controller {
	
	//发送验证码
	public function indexAction(){

		$verify=new \Register\Model\MemberVerifyModel();

		if($id=$verify->Forgotpassword()){
			$this->ajaxReturn(array('title'=>'找回密码','message'=>'发送验证码成功!','status'=>'ok','refresh'=>true,'url'=>'/forgotpassword/verify/index/id/'.$id,$_POST['datatype']));
		}else{
			$this->ajaxReturn(array('title'=>'提交失败','message'=>$verify->getError(),'status'=>'error','refresh'=>true),$_POST['datatype']);
		}
	}
	
	//检查验证码
	public function verifyAction(){
		$verify=new \Register\Model\MemberVerifyModel();

		if($id=$verify->ForgotVerify()){
			$this->ajaxReturn(array('title'=>'找回密码','message'=>'验证成功!新密码已发送的您的邮箱或手机上','status'=>'ok','refresh'=>true,'url'=>'/login',$_POST['datatype']));
		}else{
			$this->ajaxReturn(array('title'=>'提交失败','message'=>$verify->getError(),'status'=>'error','refresh'=>true),$_POST['datatype']);
		}
	}
}